import request from '@/utils/request'
import { IGetMenuPages, IMenuPagesReturn, ISaveAndUpdate } from '../types'

// 按条件分页查询菜单
export const getMenuPages = (data:IGetMenuPages) => {
  return request<IMenuPagesReturn>({
    method: 'POST',
    url: '/boss/menu/getMenuPages',
    data
  })
}

// 提交 addmenu 表单的
export const saveOrUpdate = (data:ISaveAndUpdate) => {
  return request<boolean>({
    method: 'POST',
    url: '/boss/menu/saveOrUpdate',
    data
  })
}

// 获取某条信息，可不传默认-1获取所有
export const getEditMenuInfo = (id = -1) => {
  return request<IEditMenuInfo>({
    method: 'GET',
    url: '/boss/menu/getEditMenuInfo',
    params: {
      id
    }
  })
}
